home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10970 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1005 b 

  1. Path: news.scsn.net!usenet
  2. From: shrader@scsn.net (Scott Shrader)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Beginer C please help me
  5. Date: 21 Mar 1996 00:13:46 GMT
  6. Organization: South Carolina SuperNet, Inc.
  7. Message-ID: <4iq6vq$evq@daryl.scsn.net>
  8. References: <DoLCFx.B7x.0.bloor@torfree.net>
  9. NNTP-Posting-Host: cola71.scsn.net
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.7
  13.  
  14. In article <DoLCFx.B7x.0.bloor@torfree.net>, bz786@torfree.net says...
  15. >
  16. >This may be a stupid mistake but "please help" me.
  17. >Thank you very much.
  18. >
  19. >#include <stdio.h>
  20. >#include <math.h>
  21. >main ()
  22. >{
  23. >float n;
  24. >n=(9/5);
  25. >printf ("n=   %1.3f\n", n);
  26. >}
  27. >I have complied and run the programme & I got the answer n=1.000
  28. >but Iam supposed to get answer 1.8.
  29. >Why I got this answer?
  30. >-- 
  31. you can write this by skipping  printf("n=   %1.3f\n", n); and put in 
  32. printf("%f",n);
  33.  
  34. Try this to see how this works. 
  35.  
  36. I'm a bit new at this too, but I think this will work.
  37.  
  38. Yours,
  39. Scott
  40. shrader@scsn.ner
  41.  
  42.